package cn.joybreeze.service.impl;

import cn.joybreeze.mapper.UserRoleMapper;
import cn.joybreeze.model.UserRoleDO;
import cn.joybreeze.service.UserRoleService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @ClassName UserRoleServiceImpl
 * @Description
 * @Author Kjwaa
 * @Email 1135274290@qq.com
 * @Date 2021/10/4 9:27
 */
@Service
public class UserRoleServiceImpl extends ServiceImpl<UserRoleMapper, UserRoleDO> implements UserRoleService {
    @Autowired
    UserRoleMapper userRoleMapper;

    @Override
    public Boolean deleteByUserId(Integer userId) {
        QueryWrapper<UserRoleDO> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("user_id", userId);
        int result = userRoleMapper.delete(queryWrapper);
        if(result > 0){
            return true;
        }
        return false;
    }
}
